package com.todo.strategy.pipeline.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/3/1 05:22
 * @description
 */
@Getter
@AllArgsConstructor
public enum OperateActionEnum {

    INSERT(1, "INSERT", "新增"),
    UPDATE(2, "UPDATE", "更新"),
    REMOTE(3, "REMOTE", "删除"),
    DISABLE(4, "DISABLE", "停用"),
    ENABLE(5, "ENABLE", "启用"),

    ;

    private static Map<Integer, OperateActionEnum> typeMap = Arrays
            .stream(OperateActionEnum.values())
            .collect(Collectors.toMap(OperateActionEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static OperateActionEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
